<?php
class IndexController extends ControllerAbstract{
	public function checkUserPermision($userPermision){
		return true;
	}
	public function init(){
		/*
		$test = array(null, true, false, 1, 1.0, 2.5, -1, '1', '-1.0', 'AlFaacxcx', 'alfnum232232323', 'test@o2.pl', 'test.pl', '', ' ');
		$methods = get_class_methods('Validator');
		foreach($methods as $method){
			echo '<h1>Metoda: '.$method.'</h1>';
			
			foreach($test as $value){
				var_dump($value);
				echo ': ';
				if(Validator::$method($value))
					echo '<span style="color: green; font-weight: bold;">true</span>';
				else 
					echo '<span style="color: red; font-weight: bold;">false</span>';
				echo '<br>';
			}
		}
		*/
		
		$this->main->cookie->prepare('dupa');
		echo $this->main->cookie->get('dupa');
		
		if($this->main->session->UserLoggedIn()){
			echo '<h1>Zalogowany</h1>';
			echo $this->main->session->getUserId();
		}else
			echo '<h1>Nie zalogowany</h1>';
		
	}
	public function begin(){
		
	 switch($this->main->get->getAction()){
	 	case 'login':
	 		$this->main->session->logIn('1', 'perm');
	 	break;
	 	case 'logout';
	 		$this->main->session->logOut();
	 	break;
	 }
	}
	public function getView(){
		return 'dejnm';
	}

}